import request from '@/utils/request'

/**
 * 添加地址
 * @param { object } data
 * @returns Promise
 */
export function addAddress(data) {
    return request({
        url: '/api/address/add',
        method: 'post',
        data
    })
}

/**
 * 修改管地址
 * @param { object } data
 * @returns Promise
 */
export function editAddress(data) {
    return request({
        url: '/api/address/edit',
        method: 'post',
        data
    })
}

/**
 * 分页获取地址
 * @param {*} params {
 *  page 页码
 *  limit 页数
 * }
 */
export function findAddressList(params) {
    return request({
        url: '/api/address/findList',
        method: 'get',
        params
    })
}

/**
 * 删除地址
 * @param {*} params {
 *  id 地址Id
 * }
 * @returns
 */
export function delAddress(params) {
    return request({
        url: '/api/address/del',
        method: 'delete',
        params: { id: params.id }
    })
}
